package com.aspose.cells;

import java.util.ArrayList;

class zlt extends zl {
   private zafy[] e;
   private boolean f;
   private boolean g;
   private int h;
   private DateTime i;

   public zlt(zhh var1, String var2) {
      super(var1, var2);
   }

   public zxz a(zxu var1, DateTime var2, double var3, boolean var5) {
      if (var5 && this.h != 0 && this.f()) {
         if (var2.compareTo(this.i) > 0) {
            return this.a(var1, var2);
         }

         var2 = var2.addMilliseconds((double)this.h);
      }

      zxz var6 = super.a(var1, var2, var3, false);
      if (var6.f() != 7) {
         return var6;
      } else {
         StringBuilder var7 = new StringBuilder();

         for(int var8 = 0; var8 < this.e.length; ++var8) {
            zxz var9;
            switch(this.e[var8].a()) {
            case 1:
               var9 = ((zht)this.e[var8]).a((zxu)var1, 14, (Object)0.0D);
               this.a(var6, var9, var7.length());
               if (!var9.c()) {
                  var7.append(var9.g());
               }
               break;
            default:
               var9 = ((zl)this.e[var8]).a(var1, var2, var3, false);
               if (!var9.c()) {
                  var7.append(var9.g());
               }
            }
         }

         var6.a(3, (String)com.aspose.cells.b.a.zr.a(var7));
         return var6;
      }
   }

   protected void a(char[] var1, int var2, int var3) {
      this.f = false;
      this.g = false;
      this.h = 500;
      boolean var4 = false;
      boolean var5 = false;
      ArrayList var6 = new ArrayList(3);
      StringBuilder var7 = new StringBuilder(var3 - var2);
      super.e(var1, var2, var3, var7);
      var1 = com.aspose.cells.b.a.zr.a(var7).toCharArray();
      var7.setLength(0);
      var2 = 0;
      var3 = var1.length;

      while(true) {
         while(true) {
            int var12;
            label242:
            while(var2 < var3) {
               switch(var1[var2]) {
               case '*':
               case '_':
                  if (var4) {
                     com.aspose.cells.b.a.a.ze.a(var6, (Object)com.aspose.cells.b.a.zr.a(var7));
                     var7.setLength(0);
                     var4 = false;
                  }

                  var5 = true;
                  var7.append(var1[var2]);
                  ++var2;
                  var7.append(var1[var2]);
                  ++var2;
                  break;
               case '.':
                  if (var2 > 0 && var1[var2 - 1] == 's') {
                     ++var2;

                     for(var12 = var2; var2 < var3 && var1[var2] == '0'; ++var2) {
                        ;
                     }

                     if (var2 > var12) {
                        this.a(var6, var7, var4, var5, new zboi(this.a, (String)null, (String)null, var2 - var12));
                        var4 = false;
                        var5 = false;
                        switch(var2 - var12) {
                        case 1:
                           this.h = Math.min(50, this.h);
                           break;
                        case 2:
                           this.h = Math.min(5, this.h);
                           break;
                        default:
                           this.h = 0;
                        }
                     } else {
                        var7.append('.');
                     }
                  } else {
                     var7.append('.');
                     ++var2;
                  }
                  break;
               case 'A':
               case 'a':
                  if (var2 + 2 < var1.length) {
                     com.aspose.cells.b.a.c.zb var11;
                     zboe var14;
                     switch(var1[var2 + 1]) {
                     case '/':
                        if (var1[var2 + 2] != 'p' && var1[var2 + 2] != 'P') {
                           break;
                        }

                        var14 = null;
                        if (this.a.d() != 0) {
                           var11 = com.aspose.cells.a.c.zj.a(this.a.d()).e();
                           var14 = new zboe(this.a, (String)null, (String)null, var11.g, var11.h);
                        } else {
                           var14 = new zboe(this.a, (String)null, (String)null, new String(var1, var2, 1), new String(var1, var2 + 2, 1));
                        }

                        this.a(var6, var7, var4, var5, var14);
                        var4 = false;
                        var5 = false;
                        var2 += 3;
                        this.a(64);
                        continue;
                     case 'A':
                     case 'a':
                        var12 = var2 + 2;

                        label200:
                        while(var12 < var1.length) {
                           switch(var1[var12]) {
                           case 'A':
                           case 'a':
                              ++var12;
                              break;
                           default:
                              break label200;
                           }
                        }

                        if (var12 - var2 > 2) {
                           this.a(var6, var7, var4, var5, new zbok(this.a, (String)null, (String)null, var12 - var2 > 3));
                           this.a(256);
                           var4 = false;
                           var5 = false;
                           var2 = var12;
                           continue;
                        }
                        break;
                     case 'M':
                     case 'm':
                        if (var1[var2 + 2] == '/' && var2 + 4 < var1.length && (var1[var2 + 3] == 'p' || var1[var2 + 3] == 'P') && (var1[var2 + 4] == 'm' || var1[var2 + 4] == 'M')) {
                           var14 = null;
                           if (this.a.d() != 0) {
                              var11 = com.aspose.cells.a.c.zj.a(this.a.d()).e();
                              var14 = new zboe(this.a, (String)null, (String)null, var11.g, var11.h);
                           } else {
                              var14 = new zboe(this.a, (String)null, (String)null, new String(var1, var2, 2), new String(var1, var2 + 3, 2));
                           }

                           this.a(var6, var7, var4, var5, var14);
                           var4 = false;
                           var5 = false;
                           this.a(64);
                           var2 += 5;
                           continue;
                        }
                     }
                  }

                  var2 = this.b(var1, var2, var1.length, var7);
                  break;
               case 'G':
               case 'g':
                  if (var5) {
                     this.a(var6, var7);
                     var5 = false;
                  }

                  var4 = true;
                  var7.append(var1[var2]);
                  ++var2;

                  while(true) {
                     if (var2 >= var3 || (var1[var2] | 32) != 103) {
                        continue label242;
                     }

                     var7.append(var1[var2]);
                     ++var2;
                  }
               case 'H':
               case 'd':
               case 'h':
               case 'm':
               case 's':
               case 'y':
                  if (var5) {
                     this.a(var6, var7);
                     var5 = false;
                  }

                  var4 = true;
                  var7.append(var1[var2]);
                  ++var2;
                  break;
               case 'M':
                  for(var12 = var2++; var2 < var3 && var1[var2] == 'M'; ++var2) {
                     ;
                  }

                  if (var2 - var12 == 5) {
                     this.a(var6, var7, var4, var5, new zboh(this.a, (String)null, (String)null));
                     var4 = false;
                     var5 = false;
                     break;
                  } else {
                     if (var5) {
                        this.a(var6, var7);
                        var5 = false;
                     }

                     var4 = true;

                     while(true) {
                        if (var12 >= var2) {
                           continue label242;
                        }

                        var7.append('M');
                        ++var12;
                     }
                  }
               case '[':
                  if (var2 + 1 < var3) {
                     byte var8 = -1;
                     switch(var1[var2 + 1]) {
                     case 'H':
                     case 'h':
                        var8 = 0;
                        break;
                     case 'M':
                     case 'm':
                        var8 = 1;
                        break;
                     case 'S':
                     case 's':
                        var8 = 2;
                     }

                     if (var8 > -1) {
                        this.f = true;
                        var2 += 2;

                        int var9;
                        for(var9 = var2; var2 < var3 && var1[var2] != ']'; ++var2) {
                           ;
                        }

                        ++var2;
                        this.a(var6, var7, var4, var5, new zboj(this.a, (String)null, (String)null, var8, var2 - var9));
                        var4 = false;
                        var5 = false;
                        break;
                     }
                  }

                  var2 = this.a.a(var1, var2, var3, var7, false);
                  break;
               case '上':
                  if (var2 + 5 < var1.length && var1[var2 + 1] == zml.b[1] && var1[var2 + 2] == '/' && var1[var2 + 3] == zml.c[0] && var1[var2 + 4] == zml.c[1]) {
                     this.a(var6, var7, var4, var5, new zboe(this.a, (String)null, (String)null, new String(var1, var2, 2), new String(var1, var2 + 3, 2)));
                     var4 = false;
                     var5 = false;
                     this.a(64);
                     var2 += 5;
                     break;
                  }

                  var7.append(var1[var2]);
                  ++var2;
                  break;
               default:
                  var2 = this.b(var1, var2, var3, var7);
               }
            }

            if (var4) {
               com.aspose.cells.b.a.a.ze.a(var6, (Object)com.aspose.cells.b.a.zr.a(var7));
            } else if (var5) {
               this.a(var6, var7);
               var5 = false;
            } else if (var7.length() > 0) {
               if (var6.size() > 0) {
                  ((zt)var6.get(var6.size() - 1)).b(this.a(var7));
               } else {
                  com.aspose.cells.b.a.a.ze.a(var6, (Object)com.aspose.cells.b.a.zr.a(var7));
               }
            }

            if (var6.size() > 0) {
               this.e = new zafy[var6.size()];

               for(var12 = 0; var12 < this.e.length; ++var12) {
                  if (var6.get(var12) instanceof String) {
                     String var13 = (String)var6.get(var12);
                     char[] var10 = var13.toCharArray();
                     if (this.b(64)) {
                        if (zj.a(var10, 0, var10.length, 'H', 'h')) {
                           var13 = new String(var10);
                        }
                     } else if (zj.a(var10, 0, var10.length, 'h', 'H')) {
                        var13 = new String(var10);
                     }

                     this.e[var12] = new zbmm(this.a, var13, false, this.d);
                     this.g = true;
                  } else {
                     this.e[var12] = (zafy)var6.get(var12);
                     if (!this.g && this.e[var12].a() == 3) {
                        this.g = ((zl)this.e[var12]).f();
                     }
                  }
               }
            }

            if (this.h > 0) {
               this.i = DateTime.b.addMilliseconds((double)(-this.h));
            }

            return;
         }
      }
   }

   private void a(ArrayList var1, StringBuilder var2, boolean var3, boolean var4, zt var5) {
      if (var3) {
         com.aspose.cells.b.a.a.ze.a(var1, (Object)com.aspose.cells.b.a.zr.a(var2));
         var2.setLength(0);
      } else if (var4) {
         this.a(var1, var2);
      } else if (var2.length() > 0) {
         var5.a(this.a(var2));
      }

      com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
   }

   private void a(ArrayList var1, StringBuilder var2) {
      zht var3 = new zht(this.a, com.aspose.cells.b.a.zr.a(var2));
      var2.setLength(0);
      com.aspose.cells.b.a.a.ze.a(var1, (Object)var3);
   }

   private String a(StringBuilder var1) {
      label28:
      for(int var2 = 0; var2 < var1.length(); ++var2) {
         switch(var1.charAt(var2)) {
         case '"':
            var1.delete(var2, var2 + 1);

            while(true) {
               if (var2 >= var1.length()) {
                  continue label28;
               }

               if (var1.charAt(var2) == '"') {
                  var1.delete(var2, var2 + 1);
                  --var2;
                  continue label28;
               }

               ++var2;
            }
         case '\\':
            var1.delete(var2, var2 + 1);
         }
      }

      String var3 = com.aspose.cells.b.a.zr.a(var1);
      var1.setLength(0);
      return var3;
   }

   public boolean e() {
      return this.f;
   }

   public boolean f() {
      return this.g;
   }

   public int a() {
      return 3;
   }
}
